home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 105 (1991-02)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 105 (1991-02)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / AmigaUUCP / dnews / postnews.c < prev    next >
C/C++ Source or Header  |  1990-10-08  |  1KB  |  64 lines

  1.  
  2. /*
  3.  *  POSTNEWS.C
  4.  *
  5.  *  note:   TmpFileName() may already be in use, do not use the call.
  6.  *  note:   PostNews deletes files for us
  7.  *  note:   grp might not be known, thus we cannot use the cache to
  8.  *        obtain Referencs: and Message-ID:
  9.  *
  10.  */
  11.  
  12. #include "defs.h"
  13.  
  14. Prototype void PostNews(FILE *, char *);
  15.  
  16. void
  17. PostNews(refi, infile)
  18. FILE *refi;        /*  can be NULL:, used to get References:   */
  19. char *infile;
  20. {
  21.     char reffile[64];
  22.     FILE *xfi;
  23.     static short Count;
  24.  
  25.     sprintf(reffile, "T:dnews-%06lx%04x", (unsigned long)FindTask(NULL) >> 2, Count);
  26.     ++Count;
  27.  
  28.     xfi = fopen(reffile, "w");
  29.     if (xfi == NULL) {
  30.     printf("Couldn't create %s\n", reffile);
  31.     return;
  32.     }
  33.     if (refi) {
  34.     char *field;
  35.  
  36.     fprintf(xfi, "References: ");
  37.     if (field = FindField(refi, "References:")) {
  38.         fprintf(xfi, " %s", field);
  39.         free(field);
  40.     }
  41.     if (field = FindField(refi, "Message-ID:")) {
  42.         fprintf(xfi, " %s", field);
  43.         free(field);
  44.     }
  45.     fprintf(xfi, "\n");
  46.     }
  47.     fclose(xfi);
  48.  
  49.     /*
  50.      *    -x option to postnews deletes file
  51.      */
  52.  
  53.     sprintf(TmpBuf, "RUN <nil: >nil: %s %s -R %s -x %s -x %s",
  54.     GetConfigProgram(POSTNEWS),
  55.     infile,     /*  news file    */
  56.     reffile,    /*  -R        */
  57.     infile,     /*  done/delete */
  58.     reffile     /*  done/delete */
  59.     );
  60.     system(TmpBuf);
  61. }
  62.  
  63.  
  64.